﻿// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/ContentWidget.h"
#include "Widget/SElementUIBorder.h"
#include "ElementUIBorder.generated.h"

UCLASS(meta=(DisplayName="Border"))
class ELEMENTUIUMG_API UElementUIBorder : public UContentWidget
{
	GENERATED_BODY()
public:
	UElementUIBorder();
	virtual void SynchronizeProperties() override;
	
protected:
	virtual TSharedRef<SWidget> RebuildWidget() override;
	virtual void PostLoad() override;
	virtual void ReleaseSlateResources(bool bReleaseChildren) override;

	virtual UClass* GetSlotClass() const override;
	virtual void OnSlotAdded(UPanelSlot* Slot) override;
	virtual void OnSlotRemoved(UPanelSlot* Slot) override;

#if WITH_EDITOR
	virtual const FText GetPaletteCategory() override;
#endif

private:
	TSharedPtr<SElementUIBorder> ElementUIBorderSlate;
	
	UPROPERTY(EditAnywhere, Category=Border,meta = (AllowPrivateAccess = "true"))
	FLinearColor LineColor;
	
	UPROPERTY(EditAnywhere, Category=Border,meta = (AllowPrivateAccess = "true", ClampMin="0"))
	int32 LineThickness;

	UPROPERTY(EditAnywhere, Category=Border,meta = (AllowPrivateAccess = "true", ClampMin="0"))
	float FilletRadius;
	
	UPROPERTY(EditAnywhere, Category=Border,meta = (AllowPrivateAccess = "true"))
	TEnumAsByte<EElementUIBorederLineType> LineType;

	UPROPERTY(EditAnywhere, Category=Border,meta = (AllowPrivateAccess = "true", EditCondition="LineType == EElementUIBorederLineType::Dashed", EditConditionHides))
	float DashedLength;

	UPROPERTY(EditAnywhere, Category=Border,meta = (AllowPrivateAccess = "true", EditCondition="LineType == EElementUIBorederLineType::Dashed", EditConditionHides))
	float DashedInterval;

	UPROPERTY(EditAnywhere, Category=Border,meta = (AllowPrivateAccess = "true", EditCondition="LineType == EElementUIBorederLineType::Dashed", EditConditionHides))
	float DashedOffset;
	
};
